package model

import (
	"time"
)

type BookStatus string

const (
	Available BookStatus = "AVAILABLE"
	Borrowed  BookStatus = "BORROWED"
	Lost      BookStatus = "LOST"
)

type Book struct {
	ID          uint       `gorm:"primaryKey" json:"id"`
	ISBN        string     `gorm:"uniqueIndex;size:20" json:"isbn"`
	Title       string     `gorm:"size:255;not null" json:"title"`
	Author      string     `gorm:"size:100;not null" json:"author"`
	Description string     `gorm:"type:text" json:"description"`
	PublishDate time.Time  `json:"publish_date"`
	Status      BookStatus `gorm:"type:ENUM('AVAILABLE','BORROWED','LOST');default:'AVAILABLE'" json:"status"`
	CreatedAt   time.Time  `gorm:"autoCreateTime" json:"created_at"`
	UpdatedAt   time.Time  `gorm:"autoUpdateTime" json:"updated_at"`
}
